package test;

import java.util.concurrent.*;

/**
 * @author xgy
 * @date 2020-09-12 19:28
 */

public class Demo1 {
    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread(new MyThread());
        ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(5, 10, 2, TimeUnit.SECONDS, new ArrayBlockingQueue<>(10), Executors.defaultThreadFactory(), new ThreadPoolExecutor.AbortPolicy());
        for (int i = 0; i < 10; i++) {
            threadPoolExecutor.submit(thread);
        }
        threadPoolExecutor.shutdown();
    }
}
